package com.five.reader.mapper;

import com.five.pojo.Reader;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface ReaderMapper {
    
    Reader selectById(Long id);
    
    Reader selectByUsername(String username);
    
    Reader selectByPhone(String phone);
    
    Reader selectByEmail(String email);
    
    List<Reader> selectAll();
    
    int insert(Reader reader);
    
    int update(Reader reader);
    
    int updateLastLoginTime(@Param("id") Long id, @Param("lastLoginTime") LocalDateTime lastLoginTime);
    
    // 修正：使用多个参数而不是Map
    int updatePassword(@Param("id") Long id, @Param("password") String password, @Param("salt") String salt);
    
    int updateStatus(@Param("id") Long id, @Param("status") Integer status);
    
    int deleteById(Long id);
    
    int deletePhysical(Long id);
    
    Long count();
    
    List<Reader> selectByPage(Map<String, Object> params);
}